

<div class="layui-form" lay-filter="layuiadmin-form-useradmin" style="padding: 20px 0 0 0;">  
  <script type="text/html" template>
      <input type="hidden" name="id" value="{{ d.params.id }}" />
  </script>
  <div class="layui-form-item">
    <label class="layui-form-label">登录手机</label>
    <div class="layui-input-group">
        <script type="text/html" template>
            {{#  if(d.params.id > 0){ }}
            <input type="text" name="phoneNumber" value="{{ d.params.phoneNumber || '' }}" lay-verify="required|phone" readonly  placeholder="请输入登录手机" autocomplete="off" class="layui-input" />
            <div class="layui-input-suffix">
                登录手机不可修改!
            </div>
            {{#  }else{ }}
            <input type="text" name="phoneNumber" value="{{ d.params.phoneNumber || '' }}" lay-verify="required|phone" placeholder="请输入登录手机" autocomplete="off" class="layui-input">
            {{#  } }}
        </script>
    </div>
  </div>
  <div class="layui-form-item">
    <label class="layui-form-label">邮箱</label>
    <div class="layui-input-inline">
      <script type="text/html" template>
        <input type="text" name="email" value="{{ d.params.email || '' }}" lay-verify="" placeholder="请输入邮箱" autocomplete="off" class="layui-input">
      </script>
    </div>
  </div>
  <div class="layui-form-item">
      <label class="layui-form-label">昵称</label>
      <div class="layui-input-inline">
          <script type="text/html" template>
              <input type="text" name="nickName" value="{{ d.params.nickName || '' }}" lay-verify="" placeholder="请输入昵称" autocomplete="off" class="layui-input">
          </script>
      </div>
  </div>
  <div class="layui-form-item">
    <label class="layui-form-label">角色</label>
    <div class="layui-input-block">
      <script type="text/html" template>
        <input type="radio" name="role" value="ADMIN" title="系统管理员" {{ d.params.role === 'ADMIN' ? 'checked' : '' }}>
        <input type="radio" name="role" value="TENANT" title="租户" {{ d.params.role === 'TENANT' ? 'checked' : '' }}>
      </script>
    </div>
  </div>
  <div class="layui-form-item">
    <label class="layui-form-label"></label>
    <div class="layui-input-inline">
      <input type="button" lay-submit lay-filter="LAY-user-front-submit" value="确认" class="layui-btn">
    </div>
  </div>
</div>

<script>
layui.use(['admin', 'form', 'upload'], function(){
  var $ = layui.$
  ,form = layui.form
  ,upload = layui.upload;
  
  //上传头像
  upload.render({
    elem: '#layuiadmin-upload-useradmin'
    ,url: './res/json/upload/demo.js'
    ,accept: 'images'
    ,method: 'get'
    ,acceptMime: 'image/*'
    ,done: function(res){
      $(this.item).prev("div").children("input").val(res.data.src)
    }
  });
})
</script>